<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class GoodsComment extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'oid' => 'require|number',
        'goods_id' => 'require|number',
        'content' => 'require',
        'score' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'oid.require' => '缺少订单id',
        'oid.number' => '参数错误',
        'goods_id.require' => '缺少商品id',
        'goods_id.number' => '参数错误',
        'content.require' => '评论内容必填',
        'score.require' => '评分必选',
    ];
}
